// 添加我的验证方式
<template>
    <info-block :editable="false">
        <div slot="title">添加我的验证方式</div>
        <div slot="read-box">
            <RadioGroup v-model="addMode" vertical>
                <Radio v-for="(item, index) in baseMode" :key="`add-mode-${index}`" :label="item">
                    {{ item }}
                </Radio>
                <div class="question-container">
                    <div class="question" v-for="(item, index) in questions" :key="`question-${index}`">
                        <div class="question-text">
                            问题 {{ index + 1 }}
                            <span class="question-del" v-if="addMode === baseMode[2]" @click="delQuestion(index)">一</span>
                        </div>
                        <Input v-if="addMode === baseMode[2]" v-model="item.question" style="margin-bottom: 10px;"/>
                        <Input v-else disabled v-model="item.question" style="margin-bottom: 10px"/>
                        <div class="question-text">答案</div>
                        <Input v-if="addMode === baseMode[2]" v-model="item.answer"/>
                        <Input v-else disabled v-model="item.answer"/>
                    </div>
                    <Button style="margin-left: 1.2rem" v-if="addMode === baseMode[2]" @click="addQuestion()">
                        添加问题
                    </Button>
                    <Button style="margin-left: 1.2rem" v-else disabled>
                        添加问题
                    </Button>
                </div>
            </RadioGroup>
            <div style="margin: 20px 0; text-align: center">
                <Button type="primary" v-if="changed()" disabled>
                    保存
                </Button>
                <Button type="primary" v-else @click="save">
                    保存
                </Button>
            </div>
        </div>
    </info-block>
</template>

<script lang='ts'>
import { AddMeMethod } from "./Index";
export default AddMeMethod;
</script>

<style lang='scss' scoped>
@import './Index.scss';
</style>